package com.jzit168.library_utils

import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy

/**
 *@Desc:
 *@Author: Android Developer
 *@Date: 2020/10/14
 *
 **/
object LogUtil {

    private const val TAG = "LogUtil"

    //注册logger日志工具
    fun initLogger() {
        val formatStrategy = PrettyFormatStrategy.newBuilder()
            .showThreadInfo(false)
            .tag(TAG)
            .build()
        Logger.addLogAdapter(object :AndroidLogAdapter(formatStrategy){
            override fun isLoggable(priority: Int, tag: String?): Boolean {
                return true
            }
        })
    }

    fun d(msg: Any?) {
        Logger.d("$msg")
    }

    fun i(msg: Any?) {
        Logger.i("$msg")
    }

    fun w(msg: Any?) {
        Logger.w("$msg")
    }

    fun e(msg: Any?) {
        Logger.e("$msg")
    }

    fun v(msg: Any?) {
        Logger.v("$msg")
    }

    fun json(msg: Any?) {
        Logger.json("$msg")
    }

}